LAGOS Analysis

Loading in data

First download and then specifically grab the locus (or site lat longs)

# #Lagos download script
#LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
#Load in lagos
lagos <- lagosne_load()

#Grab the lake centroid info
lake_centers <- lagos$locus

Convert to spatial data

#Look at the column names
#names(lake_centers)

#Look at the structure
#str(lake_centers)

#View the full dataset
#View(lake_centers %>% slice(1:100))

spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
                          crs=4326) %>%
  st_transform(2163)

#Subset for plotting
subset_spatial <- spatial_lakes %>%
  slice(1:100) 

subset_baser <- spatial_lakes[1:100,]

#Dynamic mapviewer
mapview(subset_spatial)

Subset to only Minnesota

states <- us_states()

#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
  filter(name == 'Minnesota') %>%
  st_transform(2163)

#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]

#Plotting the first 1000 lakes
minnesota_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

In-Class work

1) Show a map outline of Iowa and Illinois (similar to Minnesota map upstream)

IA_IL <- states %>%
  filter(name == "Iowa" | name == "Illinois") %>%
  st_transform(2163)


mapview(IA_IL)

2) Subset LAGOS data to these sites, how many sites are in Illinois and Iowa combined? How does this compare to Minnesota?

IA_IL_lakes <- spatial_lakes[IA_IL,]
count(IA_IL_lakes)
## Simple feature collection with 1 feature and 1 field
## Geometry type: MULTIPOINT
## Dimension:     XY
## Bounding box:  xmin: 277299.3 ymin: -824038.9 xmax: 1080254 ymax: -128993.5
## Projected CRS: NAD27 / US National Atlas Equal Area
##       n                       geometry
## 1 16466 MULTIPOINT ((277299.3 -2468...

There are 16466 sites in Iowa and Illinois combined, which is a little more that half the sites in Minnesota alone.

3) What is the distribution of lake size in Iowa vs. Minnesota?

  • Here I want to see a histogram plot with lake size on x-axis and frequency on y axis (check out geom_histogram)
Q3 <- spatial_lakes %>% filter(state_zoneid == "State_14" | state_zoneid == "State_13") %>% 
  mutate(state = ifelse(state_zoneid == "State_14", paste("Minnesota"), paste("Iowa")))

ggplot(Q3, aes(lake_area_ha))+
  geom_histogram(bins = 4) +
  # scale_x_continuous(breaks = seq(0, 130000, 4))
  facet_wrap(~state) 

 max(Q3$lake_area_ha)
## [1] 123779.8

The majority of lakes in both states are under 25,000 acres. Minnesota has many more lakes.

4) Make an interactive plot of lakes in Iowa and Illinois and color them by lake area in hectares

IA_IL_lakes %>%
  arrange(-lake_area_ha) %>%
  mapview(.,zcol = 'lake_area_ha')

5) What other data sources might we use to understand how reservoirs and natural lakes vary in size in these three states?

Lake volume could be a more meaningful metric than lake area for people interested in available water for agriculture or other purposes.